package first.forHuaWei.bfs;


/**
 * @ClassName LC101
 * @description:
 * @author: 荣燊
 * @create: 2021-09-07 14:54
 **/
public class LC101 {
    // 对称二叉树


    public static void main(String[] args) {

    }

    public static boolean isSymmetric(TreeNode root) {
        return check(root.left, root.right);
    }

    public static boolean check(TreeNode p, TreeNode q) {
        if (p == null && q == null) {
            return true;
        }
        if (p == null || q == null) {
            return false;
        }
        return (p.val == q.val) && check(p.left, q.right) && check(p.right, q.left);
    }
}
